		  var gridIncWlPathdata =  new Array();
          var queryIncWlPathdata =  new Array();
          var queryIncWlPathvo=new WlPathVOJs(); //
          var totalCountIncWlPath=0 ;
          var totalpageIncWlPath=0 ;
          var pagenumberIncWlPath=1;
          var pagesizeIncWlPath=10;     
		  var orderByIncWlPath='%';
          var gridIncWlPath=undefined;
          var modelIncWlPath = new dojox.grid.data.Table(null, gridIncWlPathdata);
		  var deletedatapath=new Array();
var editfieldpath =[{type: 'dojox.GridRowView', width: '20px' },{
    	 cells:  [
				  { name: 'choise', width: 3,field:0, styles: 'text-align: center;', editor: dojox.grid.editors.Bool },//
				   { name: 'No.', width: 2, styles: 'text-align: center;', get: function(inRowIndex){ return inRowIndex+1;} },//
				   {name: 'pathName', field: 2,width: 10 , editor: mydojo.ValidationTextBox ,required:true ,maxLength:30,invalidMessage:'can not be empty'}
				,  {name: 'distance',field:3, width: 8,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4 } }
				,  {name: 'loanStandard',field:4, width: 8,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4 } }
				,  {name: 'time',field:5, width: 8,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4 } }
				,  {name: 'startPlace', field: 6,width: 10 }
				,  {name: 'endPlace', field: 7,width: 10 }
				   ] 
   }];
   
var getVOIncWlPath=function(queryIncWlPathvo,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath){

      var pu = new SOAPClientParameters2();
	  pu.add('endPlaceID',queryIncWlPathvo) ;
      //pu.add('WlPathVO',queryIncWlPathvo) ;
      //pu.add('pageNumber',pagenumberIncWlPath) ;
	   // pu.add('pageSize',pagesizeIncWlPath) ;
	   // pu.add('orderBy',orderByIncWlPath) ;
      SOAPClient.invoke(url,"getPathvoByEndPlace", pu, false,  function GetEnu_callBack(ul, soapResponse){      
           queryIncWlPathdata=WlPathVOtoArray_fun(ul,false);
           totalCountIncWlPath=ul[ul.length-1]["ns:id"]; 
           totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
           document.getElementById("rowCountIncWlPath").innerHTML=" "+pagenumberIncWlPath+" / "+totalpageIncWlPath+" / "+totalCountIncWlPath+" " ;
      }); 
      queryIncWlPathdata.splice(queryIncWlPathdata.length-1,1);
      modelIncWlPath.setData(queryIncWlPathdata);
	  var button7 = new dijit.form.myButton({label: "pagedown", onClick: downPageIncWlPath,id:"but7IncWlPath",iconClass:"downPageIcon" });
	  document.getElementById("but7IncWlPathDiv").appendChild(button7.domNode);
	  if(totalpageIncWlPath>1){dijit.byId("but7IncWlPath").setDisabled(false);}else{dijit.byId("but7IncWlPath").setDisabled(true);}
	  //dijit.byId("grid").updateRowCount(queryIncWlPathdata.length); 
 }
//init-----------
var initTab =function(){
alert(selectNode);
var endPlace=selectNode.item["eId"];
//if(selectNode!=)
 /*var pathendplace=new WlPlaceVOJs();
 pathendplace.id=selectNode.item["eId"];
 queryIncWlPathvo.endPlace=pathendplace;*/
 getVOIncWlPath(endPlace,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath); 
      //querydataInc.splice(querydataInc.length-1,1);
	  if(gridIncWlPath==undefined){
	  modelIncWlPath = new dojox.grid.data.Table(null, queryIncWlPathdata);
				 gridIncWlPath = new dojox.Grid({
					title: "",
					id: "gridIncWlPath",
					jsId: "gridIncWlPath",
					structure: editfieldpath,
					rowCount:queryIncWlPathdata.length-1,
					model:modelIncWlPath,
					singleClickEdit:true
				}, dojo.byId("gridIncWlPath"));
				
			}else{ gridIncWlPath.model.setData(queryIncWlPathdata); } 
	 //if(totalpageIncWlPath>1){dijit.byId("but7IncWlPath").setDisabled(false);}else{dijit.byId("but7IncWlPath").setDisabled(true);}	
//-------------	
}
   
var querybuttonIncWlPath=function(){
              //var p = new SOAPClientParameters2();
              var d,n;
              var validstate=0;
              //queryIncWlPathvo.id=0 ;
              queryIncWlPathvo=new WlPathVOJs();
              if(querypathNameIncWlPath.getDisplayedValue()!="")queryIncWlPathvo.pathName=querypathNameIncWlPath.getDisplayedValue();//
              n=queryNumber_fun("distance");
              if(n==null){validstate=1;}else if(n.upSign!="%"){queryIncWlPathvo.distance=n;}  
              n=queryNumber_fun("loanStandard");
              if(n==null){validstate=1;}else if(n.upSign!="%"){queryIncWlPathvo.loanStandard=n;}  
              n=queryNumber_fun("time");
              if(n==null){validstate=1;}else if(n.upSign!="%"){queryIncWlPathvo.time=n;}  
        if(validstate==0){
              pagenumberIncWlPath=1;
              getVOIncWlPath(queryIncWlPathvo,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath); 
              //if(totalpageIncWlPath>1){dijit.byId("but7IncWlPath").setDisabled(false);}else{dijit.byId("but7IncWlPath").setDisabled(true);} 
             }      
       }


 

 
var querydisIncWlPath = function(){   querydisplay("queryDivIncWlPath");   }
var allpageIncWlPath =function(){
      pagenumberIncWlPath=0;pagesizeIncWlPath=0;
      getVOIncWlPath(queryvoIncWlPath,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath);
 }
var  pagesizeChangeIncWlPath=function(mylabel){
    pagesizeIncWlPath=mylabel;
    getVOIncWlPath(queryvoIncWlPath,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath);
 }           
var upPageIncWlPath= function(){
     
     var pagenumbers=new Number(pagenumberIncWlPath)-1;
     pagenumberIncWlPath=pagenumbers.toString();
     getVOIncWlPath(queryvoIncWlPath,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath);
        //dijit.byId("grid").updateRowCount(querydata.length);      //dijit.byId("grid").update();
  			if(pagenumber==1){
        dijit.byId("but6IncWlPath").setDisabled(true);
        }
        var totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
        if(totalpageIncWlPath>pagenumberIncWlPath){
        dijit.byId("but7IncWlPath").setDisabled(false);
        }
        var totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
        document.getElementById("rowCountIncWlPath").innerHTML=" "+pagenumberIncWlPath+" / "+totalpageIncWlPath+" / "+totalCountIncWlPath+" " ; 
}
var downPageIncWlPath =function(){

       var pagenumbers=new Number(pagenumberIncWlPath)+1;
       pagenumberIncWlPath=pagenumbers.toString();
      getVOIncWlPath(queryvoIncWlPath,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath);  
      //dijit.byId("grid").updateRowCount(querydata.length);      //dijit.byId("grid").update();
			var totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
			if(totalpageIncWlPath==pagenumberIncWlPath){
			dijit.byId("but7IncWlPath").setDisabled(true);
      }
      if(pagenumber>1){
      dijit.byId("but6IncWlPath").setDisabled(false);
      }
      var totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
      document.getElementById("rowCountIncWlPath").innerHTML=" "+pagenumberIncWlPath+" / "+totalpageIncWlPath+" / "+totalCountIncWlPath+" " ; 
      
}

var call_funUpdpath =function() {
       //var s = gridIncWlPath.selection.getSelected();
       //var  d=new DateTimeQuery();
       //var n=new NumberQuery();
       var sall=gridIncWlPath.model.data;
       for(var i=0;i<sall.length;i++){
       if(sall[i][0]==true){
         var passAll=0;
         var thisCell=sall[i];
         var padd = new SOAPClientParameters2();
         var vobject=new WlPathVOJs();
         vobject.id=thisCell[1];
              if(dojox.validate.isText(thisCell[2], {minlength: 1})){vobject.pathName=thisCell[2];
             }else{gridIncWlPath.getCell(2).getNode(i).innerHTML="<span style={color:red;line-height:16px}>can not be null</span>"; passAll=1;}//not null
 
             if(dojox.validate.isInRange(thisCell[3],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[3];vobject.distance=n;
             }else{gridIncWlPath.getCell(3).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double

             if(dojox.validate.isInRange(thisCell[4],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[4];vobject.loanStandard=n;
             }else{gridIncWlPath.getCell(4).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double

             if(dojox.validate.isInRange(thisCell[5],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[5];vobject.time=n;
             }else{gridIncWlPath.getCell(5).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double
       if(passAll==0){
             if(thisCell[1]==0){//create new row
                padd.add('WlPathVO',vobject);
                SOAPClient.invoke(url, "createWlPath", padd, false,  function GetEnu_callBack(ul, soapResponse){
                gridIncWlPath.model.setDatum(ul,i,1);
                });
	         }else{//modify row
                padd.add('WlPathVO',vobject);
                SOAPClient.invoke(url, "updateWlPath", padd, false,  function GetEnu_callBack(ul, soapResponse){
                });
	         }
        } }}//for
//submit delete
          for(var i=0;i<deletedatapath.length;i++){
               var pdel = new SOAPClientParameters();      
               pdel.add('id',deletedatapath[i]);
               SOAPClient.invoke(url, "deleteWlPath", pdel, false,  function GetEnu_callBack(ul, soapResponse){
	             
	           });
          }
          deletedatapath=new Array();
          dojo.byId("rowCountIncWlPath").innerHTML = 'saved'; 
//submit delete end          
 }

var removeSelectedRowsGridpath= function(){
       //var s = gridIncWlPath.selection.getSelected();
       var s= new Array();
       var sall=gridIncWlPath.model.data;
       for(var i=0;i<sall.length;i++){
       if(sall[i][0]==true){
          s.push(i);
          var thisCell=sall[i];
          if(thisCell[1]!=0){//the row which will be deleted
            deletedatapath.splice(deletedatapath.length,0,thisCell[1]);
       }}}
       gridIncWlPath.model.remove(s);//gridIncWlPath.removeSelectedRows();
 }
        
var addRowpath = function(){
          	gridIncWlPath.addRow([false,0,"","",""],gridIncWlPath.model.getRowCount());
	        } 


